<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>后台管理</title>
    <link rel="stylesheet" type="text/css" href="/resources/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="/resources/easyui/themes/icon.css">
    <script type="text/javascript" src="/resources/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="/resources/easyui/jquery.easyui.min.js"></script>
</head>
<body>
<input type="button" value="订单查询" id="ddcx" /><input type="button" value="订单导入" id="dddr" />
<table class="easyui-datagrid" title="后台管理" style="height:300px"
       data-options="rownumbers:true,singleSelect:true,url:'/page',method:'get',toolbar:toolbar,pagination:true,onDblClickRow:onDblClickRow">
    <thead>
    <tr>
        <th data-options="field:'nickname',width:80">昵称</th>
        <th data-options="field:'phone',width:100">手机号</th>
        <th data-options="field:'add_date',width:200,align:'center'">绑定时间</th>
    </tr>
    </thead>
</table>
<script type="text/javascript">
    $("#ddcx").click(function () {
       window.open("/orders");
    });
    $("#dddr").click(function () {
        window.open("/upload");
    });
    var toolbar = [{
        text: '删除',
        iconCls: 'icon-cut',
        handler: function (a, b, c) {
            var selected = $(".easyui-datagrid").datagrid("getSelected");
            if (null != selected) {
                if (confirm("确定删除选中项吗？")) {
                    $.post("/delete", {
                        id: selected.id
                    }, function () {
                        $(".easyui-datagrid").datagrid("reload");
                    });
                }
            } else {
                alert("请选择项");
            }
        }
    }];
    function onDblClickRow(index, row) {
        window.open("/detail?id=" + row.id);
    }
    function op(a, row) {
        var htm = '';
        htm += '<a href="/buys?userid=' + row.id + '" target="_blank">购买记录</a>';
        return htm;
    }
</script>
</body>
</html>